import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
    {
        path: '/',
        name: 'Home',
        redirect: '/home',
        hidden: true
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('@/views/account/Login.vue'),
        hidden: true
    },
    {
        path: '/home',
        name: 'Admin',
        meta: {
            title: '控制台',
            icon: 'home'
        },
        component: () => import('@/layout/index.vue'),
        redirect: '/console',
        children: [
            {
                path: '/console',
                name: 'Console',
                meta: {
                    title: '首页',
                },
                component: () => import('@/views/console/index.vue')
            }
            
        ]
    },
    {
        path: '/job',
        name: 'Job',
        meta: {
            title: '热门岗位',
            icon: 'user'
        },
        component: () => import('@/layout/index.vue'),
        children: [
            {
                path: '/job-index',
                name: 'JobIndex',
                meta: {
                    title: '岗位列表'
                },
                component: () => import('@/views/job/index.vue')
            },
            {
                path: '/favorites',
                name: 'Favorites',
                meta: {
                    title: '收藏列表'
                },
                component: () => import('@/views/job/Favorites.vue')
            }
        ]
    },
    {
        path: '/404',
        component: () => import('@/views/404.vue'),
        hidden: true
    },
    {
        path: '/:pathMatch(.*)*',
        redirect: '/home',
        hidden: true
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router